<template>
  <div class="myposting">
    <div class="header">
      <router-link tag="div" to="/my" class="left">
        <img src="../assets/img/fanhui.png" alt="" />
      </router-link>
      <div class="mid">
        <h3>我的帖子</h3>
      </div>
    </div>
    <div class="poster" v-if="tuList">

      <div class="item" v-for="(item,index) in tuList" :key="index">
        <div class="top">
          <div class="user">
            <img
              src="	https://www.suoyiren.com/uc_server/images/noavatar_middle.gif?ts=1640112318"
              alt=""
            />
          </div>
          <div class="mes">
            <p>buD219855 <span>Lv.1</span></p>
            <span>2022-10-29</span>
          </div>
          <div class="del" @click="del(item.id)">
            <img src="../assets/img/del.png" alt="" />
          </div>
        </div>
        <div class="bottom">
          <p>{{item.title}}</p>
          <span>{{item.content}}</span>
          <div class="img" >
            <img v-for="(k,i) in item.fileList" :key="i"
              :src="k.content"
              alt=""
            />
          </div>
        </div>
      </div>

    </div>
  </div>
</template>

<script>
export default {
  props: ["loadList"],
  data() {
    return {
      tuList: null,
    };
  },
  methods:{
    del(id){
        let index = this.tuList.findIndex(item=>item.id==id);
        this.tuList.splice(index,1);
    }
  },
  created() {
    this.tuList=this.loadList;
  },
};
</script>

<style lang="scss" scoped>
.myposting {
  .header {
    height: 48px;
    display: flex;
    background: #4eabe8;
    align-items: center;
    .left {
      margin-left: 20px;
      img {
        width: 20px;
        height: 20px;
        background-size: 100%;
      }
    }
    .mid {
      h3 {
        color: #fff;
        line-height: 22px;
        margin-right: 30px;
        font-weight: normal;
      }
      flex: 1;
      text-align: center;
    }
  }
  .poster {
    .item {
      display: flex;
      padding: 10px 16px 10px 16px;
      flex-direction: column;
      background: #fff;
      border-bottom: 1px solid #999;
      .top {
        display: flex;
        align-items: center;
        .user {
          width: 50px;
          height: 50px;
          border-radius: 50%;
          overflow: hidden;
          img {
            width: 100%;
          }
        }
        .mes {
          flex: 1;
          padding-left: 10px;
          p {
            font-size: 17px;
            span {
              background: #ff9900;
              color: #fff;
              padding: 3px;
              font-size: 12px;
            }
          }
          span {
            color: #777777;
            font-size: 14px;
          }
        }
        .del {
          img {
            width: 20px;
            height: 20px;
            background-size: 100%;
          }
        }
      }
      .bottom {
        display: flex;
        flex-direction: column;
        margin-top: 6px;
        p {
          font-size: 18px;
        }
        span {
          color: #777777;
          font-size: 14px;
        }
        .img {
          display: flex;
          flex-wrap: wrap;
          img {
            width: 30%;
            margin: 4px;
          }
        }
      }
    }
  }
}
</style>
